<!DOCTYPE html>
<html lang="zh-CN" xml:lang="zh-CN">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>ai</title>
  <script type="text/javascript" src="./assets/jquery.js"></script>

</head>

<body>
  <textarea class="textarea" onchange="change()" placeholder="搜索内容"></textarea>
  <div class="content"></div>
  <script type="text/javascript">
    const apiHost = 'http://localhost:3000';

    function change() {
      let value = $('.textarea').val();
      console.log(value);
      getRes(value);
    };

    function getRes(value) {
      $.ajax({
        url: `${apiHost}/sendMessage`,
        type: 'post',
        data: { message: value },
        dataType: 'json',
        success: function (res) {
          console.log(res)
          $('.content').html(JSON.stringify(res))
        }
      });
    }


  </script>

</body>

</html>